<!DOCTYPE html>
<html lang="en">

<head>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <meta name="description" content="">
  <meta name="author" content="">

  <title>修改密码</title>

  <!-- Custom fonts for this template-->
  <link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
  <link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">

  <!-- Custom styles for this template-->
  <link href="css/sb-admin-2.min.css" rel="stylesheet">

  <!--2.引入angularJS框架的样式； -->
  <link rel="stylesheet" href="angularjs/pagination.css">
  <!--3.引入Layer样式； -->
  <link rel="stylesheet" href="layer/layer/theme/default/layer.css">

  <!--7.引入angularJS框架-->
  <script src="angularjs/angular.min.js"></script>

  <!--导入cookie-->
  <script src="vendor/jquery/jquery.min.js"></script>
  <script src="bootstrap/js/jquery-cookie/jquery.cookie.js"></script>

  <!--8.引入angularJS的分页框架-->
  <script src="angularjs/pagination.js"></script>
  <script src="layer/layer/layer.js"></script>
  <script>
      var cookie_user_id = $.cookie("stock_user_id");

      var app=angular.module("myapp",[]);
      app.controller("myAmendName",function ($scope,$http) {
          //修改验证用户输入的用户名是否是正确
          $scope.AmendName=function (username) {

              var username = document.getElementById('username').value;

              if (username==""){
                  layer.tips("请输入真实姓名", "#username", {tips: [3, "blue"], time: 1500});
                  return false;
              }
              $scope.userid = cookie_user_id;
              $http.get("users/user/modifyname?userid="+$scope.userid+"&username="+$scope.username).success(function (data) {
                      if (data.code==200){
                          layer.msg("修改成功",{time: 1000, icon:6,end:function(){
                                  window.location.href="setting.html";}});
                          return true;
                      }else {
                          layer.msg("修改失败!!!",{time: 1000, icon:5});
                          return false;
                      }
              })
          }
      });

  </script>
</head>

<body class="bg-gradient-primary" ng-app="myapp" ng-controller="myAmendName" >

  <div class="container">

    <!-- Outer Row -->
    <div class="row justify-content-center">

      <div class="col-xl-10 col-lg-12 col-md-9">

        <div class="card o-hidden border-0 shadow-lg my-5">
          <div class="card-body p-2">
            <!-- Nested Row within Card Body -->
            <div class="row">
              <div class="col-lg-6 d-none d-lg-block"><img src="img/ss.jpg"
                                                           style="width: 100%;height: 100%"></div>
              <div class="col-lg-6">
                <div class="p-4">
                  <div class="text-center">
                    <h1 class="h4 text-gray-900 mb-2" style="color: green;font-weight: bolder">修改姓名</h1>
                    <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
                  </div>
                  <form class="user" >
                    <div class="form-group">
                      <input  class="form-control form-control-user" type="text" id="username" ng-model="username" aria-describedby="emailHelp" placeholder="请输入真实姓名" >
                    </div>
                    <a href="#" class="btn btn-primary btn-user btn-block" ng-click="AmendName()" >
                      立即修改
                    </a>
                  </form>
                  <hr>
                </div>
              </div>
            </div>
            <div id="ta">
              </section>

              </section>
              <footer>
                <div class="container text-center">
                  <p>

                  </p>
                  <div class="divider sm-size"></div>
                  <p>
                  </p>
                </div>
              </footer>
            </div>

          </div>
        </div>

      </div>

    </div>

  </div>

  <!-- Bootstrap core JavaScript-->
  <script src="vendor/jquery/jquery.min.js"></script>
  <script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>

  <!-- Core plugin JavaScript-->
  <script src="vendor/jquery-easing/jquery.easing.min.js"></script>

  <!-- Custom scripts for all pages-->
  <script src="js/sb-admin-2.min.js"></script>

</body>

</html>
